//
//  YBRegisterViewController.m
//  YBWifiAuthSDK
//
//  Created by yiban on 16/1/21.
//  Copyright © 2016年 yiban. All rights reserved.
//

#import "YBRegisterViewController.h"

@interface YBRegisterViewController ()
@property (weak) id<YBAuthDelegate> delegate;
+ (instancetype)newController;
@end
@implementation YBRegisterViewController
+ (instancetype)newController
{
    return [super new];
}
+ (instancetype)newWithDelegate:(id<YBAuthDelegate>)delegate
{
    YBRegisterViewController *viewController = [YBRegisterViewController newController];
    if (viewController) {
        viewController.delegate = delegate;
    }
    
    return viewController;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor =[UIColor whiteColor];
    UIButton *hotAppBtn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];
    hotAppBtn.backgroundColor =[UIColor blackColor];
    [hotAppBtn setTitle:@"返回" forState:UIControlStateNormal];
    [hotAppBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:hotAppBtn];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
-(void)btnClick:(id)sender
{
    if (self.navigationController) {
        if (self.navigationController.viewControllers.count == 1) {
            [self.navigationController dismissViewControllerAnimated:YES completion:nil];
        } else {
            [self.navigationController popViewControllerAnimated:YES];
        }
    } else {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    
}
@end
